package com.cnipr.patent;

import java.lang.reflect.Type;
import java.util.HashMap;

import com.chinasofti.framework.data.Entity;
import com.chinasofti.framework.data.EntityDataAccessable;
import com.chinasofti.framework.data.FieldType;
import com.chinasofti.framework.dataaccess.IReadDataAccess;

public class PatentSearchCondition extends EntityDataAccessable {

	private static HashMap<String, FieldType> m_fields;
	private static final String ENTITY_NAME = "PatentSearchCondtion";
	private static final String KEY_FIELD = "Key";
	
	
	public static final String FIELD_ID = "id";
	public static final String FIELD_KEY = "key";
	public static final String FIELD_NAME = "name";
	public static final String FIELD_TYPE = "type";
	public static final String FIELD_GROUP = "group";
	public static final String FIELD_VISIBLE = "visible";
	public static final String FIELD_VALUE = "value";
	
	@Override
	protected void init() {
		if(m_fields == null) {
			m_fields = new HashMap<String, FieldType>();
			
			m_fields.put(FIELD_ID, new FieldType(Integer.class));
			m_fields.put(FIELD_KEY, new FieldType(String.class));
			m_fields.put(FIELD_NAME, new FieldType(String.class));
			m_fields.put(FIELD_TYPE, new FieldType(Type.class));
			m_fields.put(FIELD_GROUP, new FieldType(Character.class));
			m_fields.put(FIELD_VISIBLE, new FieldType(Boolean.class));
			m_fields.put(FIELD_VALUE, new FieldType(String.class));
		}
	}
	
	@Override
	public PatentSearchConditionParser getParser() {
		return new PatentSearchConditionParser();
	}

	
	@Override
	public HashMap<String, FieldType> getFieldTypes() {
		return m_fields;
	}

	@Override
	public String getKeyField() {
		return KEY_FIELD;
	}

	@Override
	public String getEntityName() {
		return ENTITY_NAME;
	}

	@Override
	public IReadDataAccess<? extends Entity> getDataAccessObject() {
		return new PatentSearchConditionDataAccess();
	}
}
